import { createApp } from 'vue'
import './style.css'
import App from './App.vue'
import { store } from './store/index'
import router from "./router"
import getRoutes from './permessions/route'
import * as ElementPlusIconsVue from '@element-plus/icons-vue'
const app = createApp(App)
// 将 store 实例作为插件安装
app.use(store)
// 判断本地存储中是否有用户权限
if (!sessionStorage.getItem('checkedkeys')) {
    // 本地存储没有用户权限、动态添加路由、并让vuex中用来检测是否动态添加路由的数据变为true
    getRoutes()
    store.commit('increment', true)
}
for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
    app.component(key, component)
}
app.use(router)
app.mount('#app')
